<!--
 * @Author: wuchao66_Git 2803670835@qq.com
 * @Date: 2023-11-03 13:44:52
 * @LastEditors: wuchao66_Git 2803670835@qq.com
 * @LastEditTime: 2023-11-17 11:26:30
 * @FilePath: \t161xgvue\src\views\main\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div>
        <el-container>
  <el-aside width="200px" :width="isCollapse==true?'60px':'200px'">
    <el-radio-group v-model="isCollapse" style="margin-bottom: 20px;">
  <el-radio-button :label="false">展开</el-radio-button>
  <el-radio-button :label="true">收起</el-radio-button>
</el-radio-group>
<!-- <el-menu default-active="1-4-1" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
  <el-submenu index="1">
    <template slot="title">
      <i class="el-icon-location"></i>
      <span slot="title"><router-link to="/p1">页面1系统管理</router-link></span>
    </template>
    <el-menu-item-group>
      <span slot="title">分组一</span>
      <el-menu-item index="1-1">选项1</el-menu-item>
      <el-menu-item index="1-2">选项2</el-menu-item>
    </el-menu-item-group>
    <el-menu-item-group title="分组2">
      <el-menu-item index="1-3">选项3</el-menu-item>
    </el-menu-item-group>
    <el-submenu index="1-4">
      <span slot="title">选项4</span>
      <el-menu-item index="1-4-1">选项1</el-menu-item>
    </el-submenu>
  </el-submenu>
  <el-menu-item index="2">
    <i class="el-icon-menu"></i>
    <span slot="title">导航二</span>
  </el-menu-item>
  <el-menu-item index="3" disabled>
    <i class="el-icon-document"></i>
    <span slot="title">导航三</span>
  </el-menu-item>
  <el-menu-item index="4">
    <i class="el-icon-setting"></i>
    <span slot="title">导航四</span>
  </el-menu-item>
</el-menu> -->
<el-menu
          default-active="1-4-1"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          :collapse="isCollapse"
          :router="true"
          background-color="#272c33"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
         <Menu :menuData="menuData"></Menu>
        </el-menu>
</el-aside>
  <el-container>
    <el-header>
        <div class="avater1">
            <!-- <img src="../../assets/images/9e567d380cd79123c4d03e30a0345982b3b7809c.jpg"> -->
            <img src="https://t162vue.oss-cn-hangzhou.aliyuncs.com/e487e0198618367a2ba1eec323738bd4b21ce5df.jpg">
        </div>
       
            <span ><router-link to="/p1">玩蛋了,林乐清把我活埋了</router-link> </span>
        
        <div>
            <img src="../../assets/images/QQ图片20230215111336.gif" />
            <el-row class="block-col-2">
  <el-col :span="12">
    <!-- <span class="demonstration">悬浮操作</span> -->
    <el-dropdown>
      <span class="el-dropdown-link">
        中心<i class="el-icon-arrow-down el-icon--right"></i>
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item icon="el-icon-plus">用户中心</el-dropdown-item>
        <el-dropdown-item icon="el-icon-circle-plus">论坛</el-dropdown-item>
        <el-dropdown-item @click.native="logout" icon="el-icon-circle-plus-outline">退出</el-dropdown-item>
</el-dropdown-menu>
    </el-dropdown>
  </el-col>  
  </el-row>
        </div>
        </el-header>
    <el-main>
        <router-view/>
    </el-main>
  </el-container>
</el-container>
    </div>
  </template>
  
  <script>
  import { mapMutations } from "vuex";
import { USERLOGIN, USERLOGOUT } from "../../store/types";
  import {findMenuTree} from '../../api/department'
  import Menu from '../../components/Menu'
  export default {
    components:{
      Menu
    },
    data() {
      return {
        isCollapse: true,
        menuData:[]
      };
    },
    created(){
      this.getMenuTree();
    },
    methods: {
      ...mapMutations([USERLOGIN, USERLOGOUT]),
   async getMenuTree(){
     let res=   await findMenuTree();
     this.menuData=res.data.menutree;
     console.log(res);
   }   ,
        logout(){
            if(confirm("付熠，你到底选我们5个中的哪一个")){
              this[USERLOGOUT]();
                this.$router.push("/"); 
            }
        },
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      }
    }
  }
  </script>
  
  <style lang="less" scoped>
.el-header{
    display: flex;
    justify-content: space-between;
}
    img{
        height: 60px;
       width:  60px;
       border-radius: 50%;
    }
  
  .el-menu{
    background-color: cyan;
   
  }
   .el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
  }
  .el-header, .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }
  
  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    line-height: 160px;
  }
  
  body > .el-container {
    margin-bottom: 40px;
  }
  
  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }
  
  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
  </style>